cmake_minimum_required(VERSION 3.18)
project(ListDemo)

# 1. 创建列表
set(SRCS "main.cpp; add.cpp sub.cpp")
# 2. 添加元素
list(APPEND SRCS "math.cpp")
message(STATUS "append: ${SRCS}")
# 3. 移除元素
list(REMOVE_ITEM SRCS "math.cpp")
message(STATUS "remove: ${SRCS}")
# 4. 排序
list(SORT SRCS)
message(STATUS "sort: ${SRCS}")
# 5. 遍历列表
foreach(f ${SRCS})
    message(STATUS "file: ${f}")    
endforeach()
# 6. 求长度
list(LENGTH SRCS LEN)
message(STATUS "len(SRCS): ${LEN}")